﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace _MetalSlug.Form.OptionScreen
{
    public abstract class SettingDisplayer : VisibleGameEntity
    {
        protected String title;

        public String Title
        {
            get { return title; }
            set { title = value; }
        }

        protected Boolean isSetting;
        public Boolean IsSetting
        {
            get { return isSetting; }
            set { isSetting = value; }
        }

        protected Vector2 startPoint;
        public Vector2 StartPoint
        {
            get { return startPoint; }
            set { startPoint = value; }
        }

        protected float spacing;
        public float Spacing
        {
            get { return spacing; }
            set { spacing = value; }
        }

        public virtual void InitialAttribute(String TitleDisplay,Vector2 Position, float Space)
        {
            Title = TitleDisplay;
            IsSetting = false;
            StartPoint = Position;
            Spacing = Space;
        }

        public virtual void Draw(SpriteBatch spriteBatch, SpriteFont currentFont, Color defaultColor, Color chosenColor)
        {
            Color currentColor = defaultColor;
            if (IsSetting)
            {
                currentColor = chosenColor;
            }
            spriteBatch.DrawString(currentFont, Title, StartPoint, currentColor);
        }

        public override void Update(GameTime gameTime)
        {
            SwitchingSetting();
            ChangeOption();
        }


        public virtual void ChangeOption()
        {

        }


        public virtual void SwitchingSetting()
        {
            if (UserInput.isKeyClicked(Keys.Down) || UserInput.isKeyClicked(Keys.Up))
            {
                IsSetting = false;
                return;
            }
        }
    }
}
